package cn.iocoder.yudao.module.promotion.enums.kefu;

import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 会话申请的目标对象枚举
 *
 */
@AllArgsConstructor
@Getter
public enum ReceiverBelongsEnum implements IntArrayValuable {
    ADMIN(3, "平台"),
    MERCHANT(7, "商家"),
    CUSTOMER(8, "普通用户");

    public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ReceiverBelongsEnum::getType).toArray();

    private final Integer type;
    private final String name;

    public static ReceiverBelongsEnum valueOf(Integer type) {
        return Arrays.stream(values()).filter(item -> item.type.equals(type)).findFirst().orElse(null);
    }

    @Override
    public int[] array() {
        return ARRAYS;
    }
}
